package com.ym.consumer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {
    //基于配置类，不建议使用
    @Bean
    public FanoutExchange fanoutExchange(){
        return ExchangeBuilder.fanoutExchange("fanout.exchange1").build();
    }
    @Bean
    public Queue queue(){
        return QueueBuilder.durable("fanout.queue3").build();
    }
    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(fanoutExchange());
    }
}
